<route lang="json5" type="page">
{
  style: {
    navigationBarTitleText: '梦瑶诗歌',
    navigationStyle: 'default',
  },
  needLogin: 'true',
}
</route>
<template>
  <layout-default-uni>
    <view class="poem-page-container">
      <!-- 使用诗词列表组件 -->
      <poem-list
        :collection="collection"
        :api-path="`/api/v1/favorite/page?collection=${collection}`"
        :infinite-scroll="false"
        :show-pagination="true"
        :show-favorite="true"
      />
    </view>
  </layout-default-uni>
</template>

<script lang="ts" setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import PoemList from '@/components/poem-list/poem-list.vue'

// 接收路由参数
const collection = ref('TS') // 默认值

onLoad((options) => {
  usePageAuth()
  if (options && options.collection) {
    collection.value = options.collection.toUpperCase()
  }
})
</script>

<style lang="scss" scoped>
.poem-page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  // 与poem-list组件样式保持一致
  background: #f5f7fa;
}
</style>
